function event()
	yo = 0;
end

stringData = "";
function OnNewChar(char)
	if not ((char == "\n") or (char == "\r")) then
		if (string.byte(char) == 8) then
			stringData = string.sub(stringData, 0, stringData:len() - 1);
		else
			stringData = stringData..char;
		end
	else
		iofile = io.open("testing.txt", "a+");
		iofile:write(stringData.."\n");
		iofile:close();
		trackFound = string.find(stringData, "Also here: giant rat");
		if (trackFound ~= nil) then
			SendText("attack giant rat\r");
		end
		stringData = "";
	end
end

RegisterForEvent(EVENT_DISCONNECT, "event");
RegisterForEvent(EVENT_NEW_CHAR, "OnNewChar");
